<html>
<head><meta charset="utf-8"><title>Design meeting 2021-01-13: try_trait_v2 · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html">Design meeting 2021-01-13: try_trait_v2</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222477788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222477788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222477788">(Jan 12 2021 at 18:56)</a>:</h4>
<p>RFC: <a href="https://github.com/rust-lang/rfcs/pull/3058">https://github.com/rust-lang/rfcs/pull/3058</a></p>
<p>If you're short on time, these are the two most illustrative parts of the reference section:</p>
<ul>
<li>The actual <code>?</code> desugaring: <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#desugaring-">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#desugaring-</a></li>
<li>The use in <code>Iterator::try_find</code>, showing the HKT-like behaviour (turning a <code>Foo&lt;bool&gt;</code> into a <code>Foo&lt;Option&lt;Item&gt;&gt;</code>): <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#use-in-iterator">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#use-in-iterator</a></li>
</ul>



<a name="222620493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222620493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222620493">(Jan 13 2021 at 17:59)</a>:</h4>
<p>For anyone interested, this is starting shortly.</p>



<a name="222620894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222620894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222620894">(Jan 13 2021 at 18:02)</a>:</h4>
<p>(did I get the wrong zoom link, or are we still waiting for host?)</p>



<a name="222620922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222620922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222620922">(Jan 13 2021 at 18:02)</a>:</h4>
<p>I am waiting for host</p>



<a name="222620926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222620926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222620926">(Jan 13 2021 at 18:02)</a>:</h4>
<p>I'm still waiting for host</p>



<a name="222620948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222620948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222620948">(Jan 13 2021 at 18:02)</a>:</h4>
<p>Ping <span class="user-mention" data-user-id="239881">@Josh Triplett</span>?</p>



<a name="222621010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621010">(Jan 13 2021 at 18:02)</a>:</h4>
<p>or perhaps <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="222621023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621023">(Jan 13 2021 at 18:02)</a>:</h4>
<p>hmm</p>



<a name="222621044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621044">(Jan 13 2021 at 18:03)</a>:</h4>
<p>I just joined but I don't see anybody :)</p>



<a name="222621107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621107">(Jan 13 2021 at 18:03)</a>:</h4>
<p>Am <em>I</em> in the wrong zoom link? :)</p>



<a name="222621108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621108">(Jan 13 2021 at 18:03)</a>:</h4>
<p>Likewise.</p>



<a name="222621110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621110">(Jan 13 2021 at 18:03)</a>:</h4>
<p>calendar invite has ID 947 2813 0050</p>



<a name="222621138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621138">(Jan 13 2021 at 18:03)</a>:</h4>
<p>^ That's the one I'm in as well.</p>



<a name="222621228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621228">(Jan 13 2021 at 18:04)</a>:</h4>
<p>hm rejoining may have helped</p>



<a name="222621259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621259">(Jan 13 2021 at 18:04)</a>:</h4>
<p>I think I was in the wrong room</p>



<a name="222621317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222621317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222621317">(Jan 13 2021 at 18:04)</a>:</h4>
<p><a href="https://hackmd.io/AcQI-wG0Q1GVSHe6QaLjrA">hackmd for notes</a></p>



<a name="222629302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629302">(Jan 13 2021 at 19:04)</a>:</h4>
<p>Following up from this: it seemed like several people were saying they didn't see the value in <code>BreakHolder</code>, but what would the alternative look like?</p>



<a name="222629368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629368">(Jan 13 2021 at 19:04)</a>:</h4>
<p>How would <code>Bubble</code> look without it?</p>



<a name="222629507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629507">(Jan 13 2021 at 19:05)</a>:</h4>
<p>I think you just delete it and everything else stays the same.</p>



<a name="222629525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629525">(Jan 13 2021 at 19:05)</a>:</h4>
<p>My understanding from what was said is that we could drop the bound on bubble, and users wanting to make use of breakholder (e.g., try_find) could add it in themselves</p>



<a name="222629597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629597">(Jan 13 2021 at 19:05)</a>:</h4>
<p>i.e., we don't necessarily need to keep it as part of the rfc, because we can backwards compatibly add it later, right? (not as a bound but for the known uses at least)</p>



<a name="222629694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629694">(Jan 13 2021 at 19:06)</a>:</h4>
<p>So, we'd still need <code>type Continue</code> and <code>type Holder</code> (whatever it ends up being called), and we'd just drop the bound?</p>



<a name="222629881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629881">(Jan 13 2021 at 19:07)</a>:</h4>
<p>that's my understanding, yes</p>



<a name="222629909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222629909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222629909">(Jan 13 2021 at 19:07)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Also, I think one of the first things that confused me in the RFC's guide-level explanation was that the very first bit of example code used <code>type Holder = &lt;Result&lt;T, U&gt; as Bubble&gt;::Holder;</code> , rather than defining its own <code>Holder</code>. It felt like a massive forward-reference to things that weren't explained yet.</p>



<a name="222630034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222630034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222630034">(Jan 13 2021 at 19:08)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> I don't think the "let's define it incrementally and reuse bits from <code>Result</code>" approach is useful didactically; I think it's actively confusing.</p>



<a name="222630132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222630132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222630132">(Jan 13 2021 at 19:09)</a>:</h4>
<p>(Plus, it contributes to the "why isn't this just Result" feeling.)</p>



<a name="222630243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222630243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222630243">(Jan 13 2021 at 19:10)</a>:</h4>
<p>I'd have gotten a more intuitive explanation of Holder early on if it were <code>MyResult&lt;!, U&gt;</code>. "Oh, I see, it's <code>MyResult</code> with a hole where <code>Continue</code> was."</p>



<a name="222630949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222630949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222630949">(Jan 13 2021 at 19:14)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Thinking about it, if we can wait to define and stabilize <code>BreakHolder</code> (or whatever we call it) until later, and still successfully define an extensible <code>?</code>, that seems worth having to have more complex bounds that don't automatically imply <code>BreakHolder</code>.</p>



<a name="222630981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222630981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222630981">(Jan 13 2021 at 19:15)</a>:</h4>
<p>We could always make an alias for "<code>Bubble</code> where <code>Holder</code> is a <code>BreakHolder</code>", if need be.</p>



<a name="222631687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222631687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222631687">(Jan 13 2021 at 19:20)</a>:</h4>
<p>Thinking about that some more, I don't know that such an alias would even be needed.</p>



<a name="222631785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222631785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222631785">(Jan 13 2021 at 19:21)</a>:</h4>
<p>Since the bound on Holder is for the same continue type, but that's the case where you don't need to mention <code>BreakHolder</code> at all anyway.</p>



<a name="222632231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632231">(Jan 13 2021 at 19:24)</a>:</h4>
<p><code>zip_demo</code> needs <code>H: BreakHolder&lt;(T, U)&gt;</code> and <code>try_find</code> needs <code>R::Holder: ops::BreakHolder&lt;Option&lt;Self::Item&gt;&gt;</code> -- neither of them actually care about the bound that <code>Bubble</code> imposes on <code>Holder</code>.</p>



<a name="222632467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632467">(Jan 13 2021 at 19:26)</a>:</h4>
<p>(Technically <code>&lt;Self::Holder as BreakHolder&lt;Self::Continue&gt;&gt;::Output</code> <em>could</em> be a different type from <code>Self</code>, but nobody would actually use that; they'd just use <code>Self</code>.)</p>



<a name="222632764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632764">(Jan 13 2021 at 19:28)</a>:</h4>
<p>I can actually imagine a scenario where the output type is not self.</p>



<a name="222632834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632834">(Jan 13 2021 at 19:29)</a>:</h4>
<p>Imagine writing a function that accepts a closure, where the closure is more constrained than the possible values of the output.</p>



<a name="222632864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632864">(Jan 13 2021 at 19:29)</a>:</h4>
<p>The closure can only return an A or B or C, but the output could also have D or E.</p>



<a name="222632901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632901">(Jan 13 2021 at 19:29)</a>:</h4>
<p>So the output could be the more general type that you want, but the closure doesn't get to return those cases.</p>



<a name="222632963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222632963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222632963">(Jan 13 2021 at 19:30)</a>:</h4>
<p>The RFC actually includes such a case -- because the <code>Poll</code> impls reuse <code>Result</code>'s holder, going through <code>::Output</code> will give a result, not a <code>Poll</code>.</p>



<a name="222633024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633024">(Jan 13 2021 at 19:30)</a>:</h4>
<p>(That's another reason why reusing Result's holder in the first <code>MyResult</code> example seems confusing.)</p>



<a name="222633266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633266">(Jan 13 2021 at 19:32)</a>:</h4>
<p>I think the conversation about the bound on Holder solves the original reason for that reuse, too -- if I don't need a <code>BreakHolder</code> implementation to get the first example to compile, then there's basically no reason to reuse Result's holder instead of just talking about the residual there</p>



<a name="222633342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633342">(Jan 13 2021 at 19:33)</a>:</h4>
<p>Are there any downsides to removing the <code>BreakHolder</code> bound from <code>Bubble</code>, other than more complex bounds on functions that want to be able to plug in a different type to the same type container?</p>



<a name="222633381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633381">(Jan 13 2021 at 19:33)</a>:</h4>
<p>This might just all be fallout from one of the intermediary designs I tried that had <code>Holder: BreakHolder&lt;Output = Self&gt;</code> (as mentioned in <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#bounds-on-bubbleholder">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#bounds-on-bubbleholder</a>)</p>



<a name="222633558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633558">(Jan 13 2021 at 19:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222633342">said</a>:</p>
<blockquote>
<p>Are there any downsides to removing the <code>BreakHolder</code> bound from <code>Bubble</code>, other than more complex bounds on functions that want to be able to plug in a different type to the same type container?</p>
</blockquote>
<p>I think there might not even be more complex bounds in those cases (<a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222632231">https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222632231</a>)</p>
<p>So it might just be all upside.</p>



<a name="222633821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633821">(Jan 13 2021 at 19:36)</a>:</h4>
<p>At the risk of bikeshedding, I do think that the name <code>Holder</code> has some ambiguity. In the value space, <code>Holder</code> is a thing that holds a break. But in the type space, <code>Holder</code> is a thing that's <em>ready</em> to hold a type parameter you hand it.</p>



<a name="222633852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222633852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222633852">(Jan 13 2021 at 19:36)</a>:</h4>
<p>And when reading the RFC, the latter meaning came more readily to mind.</p>



<a name="222634114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634114">(Jan 13 2021 at 19:38)</a>:</h4>
<p>Yeah, <code>Holder</code> is pretty terrible, I agree.</p>



<a name="222634246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634246">(Jan 13 2021 at 19:39)</a>:</h4>
<p>In scenarios where you <em>don't</em> care about supporting things like <code>try_fold</code>, do you need to make <code>Holder</code> a type you define, or can you use an existing type? For instance, could the ErrorCode case do something like <code>type Holder = NonZeroI32</code>?</p>



<a name="222634461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634461">(Jan 13 2021 at 19:41)</a>:</h4>
<p>That's possible, though it has interconversion implications -- you'll need to have <code>YourWhatever: Try&lt;NonZeroI32&gt;</code>, so you'll start to interoperate with anyone else who also used that holder type.</p>



<a name="222634530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634530">(Jan 13 2021 at 19:41)</a>:</h4>
<p>Ah. Which may or may not be a feature.</p>



<a name="222634708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634708">(Jan 13 2021 at 19:42)</a>:</h4>
<p>Right.  And it's probably less a feature the more general the holder type -- see the discussion of <code>Ordering: Try&lt;bool&gt;</code> in <a href="https://github.com/rust-lang/rfcs/pull/3058#issuecomment-757598481">https://github.com/rust-lang/rfcs/pull/3058#issuecomment-757598481</a>, for example</p>



<a name="222634718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222634718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222634718">(Jan 13 2021 at 19:42)</a>:</h4>
<p>But, for instance, for the "error or pointer" type in the Linux kernel, using the errno type as the holder and interoperating with anything else using errno may be a feature.</p>



<a name="222635076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222635076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222635076">(Jan 13 2021 at 19:45)</a>:</h4>
<p>Right.  It's probably bad with just <code>NonZeroCInt</code>, but with <code>struct ErrorNumber(NonZeroCInt); impl ErrorNumber { const DOM: Self = ...; const RANGE: Self = ...; }</code> it might be perfectly reasonable.</p>



<a name="222635525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222635525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222635525">(Jan 13 2021 at 19:48)</a>:</h4>
<p>Right. I'm expecting some kind of <code>repr(transparent)</code> newtypes for errno.</p>



<a name="222635557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222635557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222635557">(Jan 13 2021 at 19:49)</a>:</h4>
<p>(Possibly two, one for "errno including success" and one for "errno that's definitely a failure".)</p>



<a name="222635606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222635606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222635606">(Jan 13 2021 at 19:49)</a>:</h4>
<p>Which is giving me a newfound appreciation for proposals on how to construct enum types from variants.</p>



<a name="222636030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636030">(Jan 13 2021 at 19:52)</a>:</h4>
<p>I'm wondering about another potential simplification...</p>



<a name="222636073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636073">(Jan 13 2021 at 19:52)</a>:</h4>
<p>Keeping a bound on Holder forces users to use a custom type for it, which may be a good thing</p>



<a name="222636102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636102">(Jan 13 2021 at 19:53)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> The desugaring for <code>?</code> doesn't use <code>continue_with</code>.</p>



<a name="222636130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636130">(Jan 13 2021 at 19:53)</a>:</h4>
<p>Does <code>continue_with</code> belong on <code>Bubble</code>, or on <code>Try</code>?</p>



<a name="222636263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636263">(Jan 13 2021 at 19:54)</a>:</h4>
<p>speaking of confusing explanations: I found the explanation in the hackmd in terms of "there's residual stuff that the user shouldn't care about" clearer than the RFC explanation</p>



<a name="222636388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636388">(Jan 13 2021 at 19:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222636130">said</a>:</p>
<blockquote>
<p>Does <code>continue_with</code> belong on <code>Bubble</code>, or on <code>Try</code>?</p>
</blockquote>
<p>If it were on <code>Try</code>, it'd probably be spelled <code>from_continue</code>.</p>



<a name="222636444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636444">(Jan 13 2021 at 19:55)</a>:</h4>
<p>(Actually, that might be true even if it's on <code>Bubble</code>, since <code>_with</code> is usually a suffix for "takes a closure".)</p>



<a name="222636460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636460">(Jan 13 2021 at 19:55)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> The type without the generic parameter, because it doesn't make sense for the interpretation of the continue value to depend on the error type (just like it doesn't make sense for the continue <em>type</em> to depend on the error type)</p>



<a name="222636598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636598">(Jan 13 2021 at 19:56)</a>:</h4>
<p>I think I should undo <a href="https://github.com/scottmcm/rust/pull/2/commits/5fa9b9d0a315d56637b30dac9df3af796ea3bec0">https://github.com/scottmcm/rust/pull/2/commits/5fa9b9d0a315d56637b30dac9df3af796ea3bec0</a> -- I originally had them as <code>TryCore</code>/<code>Try</code> because I'm not sure that trying to assign too much meaning to the difference between them is that useful</p>



<a name="222636650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636650">(Jan 13 2021 at 19:57)</a>:</h4>
<p>(<code>Core</code> wasn't a great suffix either, of course, because it makes it sounds like the <code>core</code>/<code>alloc</code>/<code>std</code> split, which is unrelated)</p>



<a name="222636671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636671">(Jan 13 2021 at 19:57)</a>:</h4>
<p><code>TryBase</code>?</p>



<a name="222636794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636794">(Jan 13 2021 at 19:58)</a>:</h4>
<p>Can you give an example where someone would <code>impl Try&lt;SomethingOtherThanTheDefault&gt;</code>?</p>



<a name="222636802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636802">(Jan 13 2021 at 19:58)</a>:</h4>
<p>Yeah, that was my next instinct -- hopefully it doesn't make the "OOP is bad" peanut gallery show up, though :P</p>



<a name="222636931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222636931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222636931">(Jan 13 2021 at 19:59)</a>:</h4>
<p><code>Result</code> (and <code>Poll</code>) implements something other than the default, to handle error conversion: <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#result">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#result</a></p>



<a name="222637095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637095">(Jan 13 2021 at 20:00)</a>:</h4>
<p>If <code>continue_with</code> was moved to <code>Try</code>, then <code>Try</code> would essentially have a single member <code>unbranch(x: ControlFlow&lt;H, Self::Continue&gt;) -&gt; Self</code> that almost mirrors <code>Bubble::branch</code> except that <code>H</code> can be changed. I would find this a bit easier to follow I think</p>



<a name="222637263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637263">(Jan 13 2021 at 20:01)</a>:</h4>
<p>oh wait this would make inference bad again</p>



<a name="222637368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637368">(Jan 13 2021 at 20:02)</a>:</h4>
<p>ok, I finally see the point of the split, sry for the noise</p>



<a name="222637396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637396">(Jan 13 2021 at 20:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222636931">said</a>:</p>
<blockquote>
<p><code>Result</code> (and <code>Poll</code>) implements something other than the default, to handle error conversion: <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#result">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#result</a></p>
</blockquote>
<p>Sorry, let me rephrase that. I think I understand why they do so; I meant, would there be value in adding to the RFC an example of implementing <code>Try</code> for some other type, in a way that doesn't just use <code>From</code>?</p>



<a name="222637575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637575">(Jan 13 2021 at 20:03)</a>:</h4>
<p><span class="user-mention" data-user-id="245339">@Nadrieril</span> I made the same mistake; it's not noise. It seems clear that there's some additional explanation and clarity needed.</p>



<a name="222637779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222637779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222637779">(Jan 13 2021 at 20:05)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> My first guess would be that it may make sense to implement <code>Try</code> yourself for multiple potential type parameters, with different implementations, effectively as your own more-constrained version of <code>From</code>.</p>



<a name="222638777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222638777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222638777">(Jan 13 2021 at 20:13)</a>:</h4>
<p>Yeah, that seems plausible.  I don't have such a situation jumping to mind, though.</p>



<a name="222638795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222638795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222638795">(Jan 13 2021 at 20:13)</a>:</h4>
<p>Hmm, maybe something about HTTP errors?</p>



<a name="222638865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222638865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222638865">(Jan 13 2021 at 20:13)</a>:</h4>
<p>There's also this sketch in the R&amp;A section:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">H</span>: <span class="nc">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="p">()</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="n">Try</span><span class="o">&lt;</span><span class="n">H</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">LogAndIgnoreErrors</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_holder</span><span class="p">(</span><span class="n">h</span>: <span class="nc">H</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="fm">dbg!</span><span class="p">(</span><span class="n">h</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="bp">Self</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Which locally I have as less of a sketch, with</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">LogAndIgnoreErrors</span><span class="p">;</span><span class="w"></span>
<span class="cp">#[derive(Debug, Copy, Clone)]</span><span class="w"></span>
<span class="k">enum</span> <span class="nc">WhatErrors</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Bubble</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">LogAndIgnoreErrors</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nb">Ok</span> <span class="o">=</span><span class="w"> </span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Holder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">WhatErrors</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ControlFlow</span><span class="o">&lt;</span><span class="n">WhatErrors</span><span class="p">,</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">ControlFlow</span>::<span class="n">Continue</span><span class="p">(())</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">continue_with</span><span class="p">(()</span>: <span class="p">())</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">WhatErrors</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">LogAndIgnoreErrors</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222638997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222638997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222638997">(Jan 13 2021 at 20:14)</a>:</h4>
<p>(Interestingly, that seems to be another good reason to remove the <code>BreakHolder</code> bound in <code>Bubble</code>/<code>TryBase</code>, since that implementation obviously doesn't care about it either.)</p>



<a name="222639312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222639312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222639312">(Jan 13 2021 at 20:17)</a>:</h4>
<p>The <code>zip_demo</code> example is interesting from a user's perspective: taking <code>impl Bubble</code> as input feels like taking <code>impl IntoIterator</code>. I guess it's a pattern that users will have to learn to read. When implementing <code>IntoIterator</code> you have to come up with an IntoIter type which is either custom or composed of other <code>IntoIter</code> types.  <code>Holder</code> works similarly for <code>Bubble</code>. I think this could be an avenue for a more legible explanation/naming scheme</p>



<a name="222641258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222641258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222641258">(Jan 13 2021 at 20:32)</a>:</h4>
<p>actually, could it be possible to get something closer to how we make new iterators, e.g. something like:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">zip_demo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">H</span><span class="p">,</span><span class="w"> </span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nc">A</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Zip</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="p">,</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">  </span><span class="n">A</span>: <span class="nc">Bubble</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">Holder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">  </span><span class="n">B</span>: <span class="nc">Bubble</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">Holder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>where <code>Zip</code> would implement the appropriate traits</p>



<a name="222641683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222641683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222641683">(Jan 13 2021 at 20:35)</a>:</h4>
<p>same question with <code>try_fold</code>. The idea being that when you want the output of your function to be bubblable and generic, you return a custom type or an <code>impl Bubble</code></p>



<a name="222642155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222642155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222642155">(Jan 13 2021 at 20:38)</a>:</h4>
<p>Unfortunately returning <code>impl Bubble</code> from things is a bit awkward as it prevents the use of methods on the return value</p>



<a name="222642219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222642219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222642219">(Jan 13 2021 at 20:39)</a>:</h4>
<p>You couldn't <code>.try_fold(...).map(...)</code>, for example, because <code>map</code> is on specific types, not on <code>Bubble</code>.</p>



<a name="222642742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222642742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222642742">(Jan 13 2021 at 20:43)</a>:</h4>
<p>hm I see, users want to have exactly their return type of choice...</p>



<a name="222644207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222644207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222644207">(Jan 13 2021 at 20:55)</a>:</h4>
<p>I don't think we need the BreakHolder bound in order to write <code>zip_demo</code>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">zip_demo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="n">a</span>: <span class="o">&lt;</span><span class="n">H</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">b</span>: <span class="o">&lt;</span><span class="n">H</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">,</span><span class="w"></span>
<span class="p">)</span><span class="w"> </span>-&gt; <span class="o">&lt;</span><span class="n">H</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">  </span><span class="n">H</span>: <span class="nc">BreakHolder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">  </span><span class="n">H</span>: <span class="nc">BreakHolder</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">  </span><span class="n">H</span>: <span class="nc">BreakHolder</span><span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Bubble</span>::<span class="k">continue</span><span class="n">_with</span><span class="p">((</span><span class="n">a</span><span class="o">?</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="o">?</span><span class="p">))</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>This is even somewhat legible if we think as the holder as "the thing that defines what the user wants returned". Maybe it would make sense to rename it <code>GenericBubble</code>. Is there something else that really needs the BreakHolder bound?</p>



<a name="222644974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222644974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222644974">(Jan 13 2021 at 21:01)</a>:</h4>
<p>Yeah, the BreakHolder bound <em>on <code>Bubble::Holder</code></em> seems to not provide value: <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222632231">https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222632231</a></p>



<a name="222645115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645115">(Jan 13 2021 at 21:02)</a>:</h4>
<p>Oh, that's an interesting phrasing of <code>zip_demo</code>.</p>



<a name="222645145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645145">(Jan 13 2021 at 21:02)</a>:</h4>
<p>ok, I was reading the hackmd</p>



<a name="222645224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645224">(Jan 13 2021 at 21:03)</a>:</h4>
<p>Did you mean "don't think we need the <code>Bubble</code> bound?", in that example?</p>



<a name="222645275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645275">(Jan 13 2021 at 21:03)</a>:</h4>
<p>I meant "don't need the BreakHolder bound on Bubble::Holder"</p>



<a name="222645372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645372">(Jan 13 2021 at 21:04)</a>:</h4>
<p>That <code>zip_demo</code> is really interesting; it's adding the other bounds it needs via the bound on <code>::Output</code>.</p>



<a name="222645438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645438">(Jan 13 2021 at 21:04)</a>:</h4>
<p>huh right, I didn't notice but it doesn't explicitly mention Bubble or Try</p>



<a name="222645807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222645807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222645807">(Jan 13 2021 at 21:07)</a>:</h4>
<p>Seems like it should even still type-infer properly, since <code>Output: Try&lt;Holder = Self&gt;</code>.</p>



<a name="222646099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646099">(Jan 13 2021 at 21:10)</a>:</h4>
<p><del>...yup, tried it out with my prototype compiler and it does.  Nicely done.</del></p>
<p>Oops, sorry, I spoke too soon.</p>



<a name="222646183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646183">(Jan 13 2021 at 21:10)</a>:</h4>
<p>It compiled, but I forgot to use it :P</p>



<a name="222646403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646403">(Jan 13 2021 at 21:12)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">zip_demo_option</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Option</span><span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">zip_demo_nadrieril</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>gives</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span><span class="p">[</span><span class="n">E0283</span><span class="p">]</span>: <span class="nc">type</span><span class="w"> </span><span class="n">annotations</span><span class="w"> </span><span class="n">needed</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="nc">C</span>:<span class="err">\</span><span class="n">src</span><span class="err">\</span><span class="n">rust</span><span class="err">\</span><span class="n">src</span><span class="o">/</span><span class="n">test</span><span class="err">\</span><span class="n">ui</span><span class="err">\</span><span class="kr">try</span><span class="o">-</span><span class="n">operator</span><span class="o">-</span><span class="n">custom</span><span class="o">-</span><span class="n">v2</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">184</span>:<span class="mi">5</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="n">zip_demo_nadrieril</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">)</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">     </span><span class="o">^^^^^^^^^^^^^^^^^^</span><span class="w"> </span><span class="n">cannot</span><span class="w"> </span><span class="n">infer</span><span class="w"> </span><span class="k">type</span> <span class="nc">for</span><span class="w"> </span><span class="k">type</span> <span class="nc">parameter</span><span class="w"> </span><span class="err">`</span><span class="n">H</span><span class="err">`</span><span class="w"> </span><span class="n">declared</span><span class="w"> </span><span class="n">on</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">function</span><span class="w"> </span><span class="err">`</span><span class="n">zip_demo_nadrieril</span><span class="err">`</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">zip_demo_nadrieril</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">        </span><span class="o">------------------</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">this</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w">   </span><span class="n">H</span>: <span class="nc">BreakHolder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">      </span><span class="o">--------------</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="err">`</span><span class="n">zip_demo_nadrieril</span><span class="err">`</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cannot</span><span class="w"> </span><span class="n">satisfy</span><span class="w"> </span><span class="err">`</span><span class="n">_</span>: <span class="nc">BreakHolder</span><span class="o">&lt;</span><span class="n">_</span><span class="o">&gt;</span><span class="err">`</span><span class="w"></span>
<span class="n">help</span>: <span class="nc">consider</span><span class="w"> </span><span class="n">specifying</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">type</span> <span class="nc">arguments</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">function</span><span class="w"> </span><span class="n">call</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="n">zip_demo_nadrieril</span>::<span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">H</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">)</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">                       </span><span class="o">^^^^^^^^^^^</span><span class="w"></span>
</code></pre></div>



<a name="222646448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646448">(Jan 13 2021 at 21:13)</a>:</h4>
<p>oh right of course &gt;&lt;</p>



<a name="222646469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646469">(Jan 13 2021 at 21:13)</a>:</h4>
<p>can't infer the H knowing only the output</p>



<a name="222646685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646685">(Jan 13 2021 at 21:15)</a>:</h4>
<p>potential naming nit: intuitively the thing that bubbles up isn't <code>Result&lt;T,E&gt;</code>, it's <code>Result&lt;!,E&gt;</code> i.e. the holder. So maybe we could call holders "bubbles" and things like <code>Option&lt;T&gt;</code> "bubblable" (love that name ^^)</p>



<a name="222646693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646693">(Jan 13 2021 at 21:15)</a>:</h4>
<p>I was hoping it could via the <code>Self</code> bound in this.</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">BreakHolder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span>: <span class="nc">Try</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">Holder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222646793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222646793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222646793">(Jan 13 2021 at 21:16)</a>:</h4>
<p>But I guess not.</p>



<a name="222647369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222647369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222647369">(Jan 13 2021 at 21:21)</a>:</h4>
<p>other idea: if the <code>Bubble::Holder : BreakHolder</code> is optional, would we have instead:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">Bubble</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="c1">// as before, without a bound on Holder</span>
<span class="p">}</span><span class="w"></span>
<span class="k">trait</span><span class="w"> </span><span class="n">GenericBubble</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span>: <span class="nc">Bubble</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">type</span> <span class="nc">Output</span>: <span class="nc">Try</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">Holder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Holder</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>that way users could entirely forget about holders:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">zip_demo</span><span class="o">&lt;</span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="n">a</span>: <span class="o">&lt;</span><span class="n">R</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">GenericBubble</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">b</span>: <span class="o">&lt;</span><span class="n">R</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">GenericBubble</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">,</span><span class="w"></span>
<span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">R</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">  </span><span class="n">R</span>: <span class="nc">Bubble</span><span class="o">&lt;</span><span class="n">Continue</span><span class="o">=</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">  </span><span class="n">R</span>: <span class="nc">GenericBubble</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">  </span><span class="n">R</span>: <span class="nc">GenericBubble</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Bubble</span>::<span class="k">continue</span><span class="n">_with</span><span class="p">((</span><span class="n">a</span><span class="o">?</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="o">?</span><span class="p">))</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>would that work? (you can easily choose which of the arguments/return value will drive inference here)</p>



<a name="222648905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222648905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222648905">(Jan 13 2021 at 21:33)</a>:</h4>
<p>I think that'd work too.  The major difference would be an unused type parameter in the implementations of GenericBubble.</p>



<a name="222649226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222649226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222649226">(Jan 13 2021 at 21:36)</a>:</h4>
<p>Right now it's</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="n">ops</span>::<span class="n">BreakHolder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nb">Result</span><span class="o">&lt;!</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Result</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>If it worked on the full bubble type, instead of the holder type, then the impl would look something like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="p">,</span><span class="w"> </span><span class="n">Yolo</span><span class="o">&gt;</span><span class="w"> </span><span class="n">GenericBubble</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nb">Result</span><span class="o">&lt;</span><span class="n">Yolo</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Result</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">E</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Now, that's not a huge deal, but I'm never a fan of unused generic parameters.</p>



<a name="222661090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222661090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222661090">(Jan 13 2021 at 23:17)</a>:</h4>
<p>(Especially for types, since we don't support <code>_</code> there like we support <code>'_</code> for irrelevant lifetime parameters.)</p>



<a name="222669028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222669028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222669028">(Jan 14 2021 at 00:55)</a>:</h4>
<p>There's an unused param in <code>impl Try for Result</code> too, right? It's kinda symmetrical</p>



<a name="222741004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222741004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222741004">(Jan 14 2021 at 16:19)</a>:</h4>
<p>Good point.</p>



<a name="222792992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222792992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222792992">(Jan 14 2021 at 22:16)</a>:</h4>
<p>Still trying to clarify the purpose of the traits. Conceptually I want <code>Bubble</code> to be the trait of things that can be put behind a <code>?</code>, i.e. things that can emit a short-circuit, and <code>Try</code> to be the type of things that can receive such a short-circuit. Then it's natural that <code>Try</code> has a parameter: why not catch a bunch of different short-circuits after all. The only weird thing is <code>continue_with</code>; it doesn't fit neatly in this idea</p>



<a name="222794901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222794901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222794901">(Jan 14 2021 at 22:31)</a>:</h4>
<p>One thing I've been mentally playing with is flipping them:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">FromTryResidual</span><span class="o">&lt;</span><span class="n">Residual</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="bp">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Try</span><span class="o">&gt;</span>::<span class="n">Residual</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_try_residual</span><span class="p">(</span><span class="n">r</span>: <span class="nc">Residual</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">trait</span><span class="w"> </span><span class="n">Try</span>: <span class="nc">FromTryResidual</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Continue</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Residual</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ControlFlow</span><span class="o">&lt;</span><span class="bp">Self</span>::<span class="n">Residual</span><span class="p">,</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Continue</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_continue</span><span class="p">(</span><span class="n">c</span>: <span class="nc">Self</span>::<span class="n">Continue</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">FromTryResidual</span><span class="o">&lt;</span><span class="nb">Result</span><span class="o">&lt;!</span><span class="p">,</span><span class="w"> </span><span class="o">!&gt;&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_try_residual</span><span class="p">(</span><span class="n">r</span>: <span class="nb">Result</span><span class="o">&lt;!</span><span class="p">,</span><span class="w"> </span><span class="o">!&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">match</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="nb">Err</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=0b9f5b76e79c25e7afd9f1ae8f65efe0">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=0b9f5b76e79c25e7afd9f1ae8f65efe0</a></p>
<p>Someone (I forget whom) asked about using infallible-<code>?</code> in <code>-&gt; ()</code> methods once, which this would allow.</p>



<a name="222795085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795085">(Jan 14 2021 at 22:33)</a>:</h4>
<p>huh, <code>&lt;Self as Try&gt;::Residual</code> is allowed without a <code>Try</code> bound? :o</p>



<a name="222795142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795142">(Jan 14 2021 at 22:33)</a>:</h4>
<p>Yeah, surprised me too :P</p>



<a name="222795172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795172">(Jan 14 2021 at 22:33)</a>:</h4>
<p>then do you even need <code>Try: FromTryResidual</code>?</p>



<a name="222795180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795180">(Jan 14 2021 at 22:33)</a>:</h4>
<p>It only needs the bound at the place where the default is actually used.</p>



<a name="222795354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795354">(Jan 14 2021 at 22:35)</a>:</h4>
<p>I still want <code>Try: FromTryResidual</code> so that the bound in something like <code>try_fold</code> can just be <code>R: Try</code>.  And I don't think there's a situation where it makes sense to be able to split a type apart but not put it back together again.</p>



<a name="222795356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795356">(Jan 14 2021 at 22:35)</a>:</h4>
<p>I was making an attempt at clarifying the roles of things with a new kind of vocabulary:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">/// Types that can be an input to `?`. A `x?` expression can either continue evaluation normally</span>
<span class="sd">/// with a value of type `Self::Continue`, or short-circuit into the nearest function boundary with</span>
<span class="sd">/// a value of type `Self::ShortCircuit`. The short-circuited value will then be converted to the</span>
<span class="sd">/// appropriate output type using `from_short_circuited`.</span>
<span class="k">trait</span><span class="w"> </span><span class="n">EmitShortCircuit</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The type of the carried data returned in the non-shortcircuiting case.</span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Continue</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The type that carried the data that get's short-circuited.</span>
<span class="w">    </span><span class="k">type</span> <span class="nc">ShortCircuit</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Decide whether or not to short-circuit.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ControlFlow</span><span class="o">&lt;</span><span class="bp">Self</span>::<span class="n">ShortCircuit</span><span class="p">,</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Continue</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="sd">/// Types that can short-circuit using the `?` operator. The trait is split in two because this may</span>
<span class="sd">/// accept more types of short-circuits than the one it emits. Typically `Result&lt;T, E&gt;` emits a</span>
<span class="sd">/// short-circuit that carries the `E`, but can accept short-circuits for any `E2: Into&lt;E&gt;`.</span>
<span class="k">trait</span><span class="w"> </span><span class="n">ShortCircuiting</span><span class="o">&lt;</span><span class="n">SC</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="bp">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">EmitShortCircuit</span><span class="o">&gt;</span>::<span class="n">ShortCircuit</span><span class="o">&gt;</span>: <span class="nc">EmitShortCircuit</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_continued</span><span class="p">(</span><span class="n">c</span>: <span class="nc">Self</span>::<span class="n">Continue</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_short_circuited</span><span class="p">(</span><span class="n">sc</span>: <span class="nc">SC</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222795475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795475">(Jan 14 2021 at 22:36)</a>:</h4>
<p>I think your inverted dependency would be even clearer because it forces a type to be able to catch its own short-circuiting</p>



<a name="222795580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795580">(Jan 14 2021 at 22:37)</a>:</h4>
<p>Yeah.  The other way only sortof did that, since the <code>::Output</code> on <code>BreakHolder</code> was bound to <code>Try&lt;Output = Self&gt;</code>.</p>



<a name="222795620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795620">(Jan 14 2021 at 22:38)</a>:</h4>
<p>But without the <code>Holder: BreakHolder</code> bound, even that weak guarantee is lost.</p>



<a name="222795833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222795833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222795833">(Jan 14 2021 at 22:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222794901">said</a>:</p>
<blockquote>
<p>Someone (I forget whom) asked about using infallible-<code>?</code> in <code>-&gt; ()</code> methods once, which this would allow.</p>
</blockquote>
<p>Why wouldn't that work with the non-flipped design?</p>



<a name="222796143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222796143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222796143">(Jan 14 2021 at 22:42)</a>:</h4>
<p>ah, because it would require <code>(): Bubble</code></p>



<a name="222796407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222796407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222796407">(Jan 14 2021 at 22:45)</a>:</h4>
<p>hm ok, that convinces me that I prefer the flipped version: it doesn't make sense for a thing to emit a short-circuit it can't catch, but the <code>()</code> example shows that it makes sense for something to receive short-circuits even if it can't emit any</p>



<a name="222796729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222796729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222796729">(Jan 14 2021 at 22:48)</a>:</h4>
<p>Can we usually avoid having <code>FromTryResidual</code>/<code>Bubble</code> show up in public APIs btw? It would make explaining things easier if it could be documented as "internal" to reduce the learning burden</p>



<a name="222797124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797124">(Jan 14 2021 at 22:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="245339">Nadrieril</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222796143">said</a>:</p>
<blockquote>
<p>ah, because it would require <code>(): Bubble</code></p>
</blockquote>
<p>Yeah, and consequently would allow <code>()??????????????????????????</code>, which would obviously be bad.</p>



<a name="222797136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797136">(Jan 14 2021 at 22:52)</a>:</h4>
<p>yup, not pretty</p>



<a name="222797431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797431">(Jan 14 2021 at 22:55)</a>:</h4>
<p><code>is_this_right()????;</code></p>



<a name="222797570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797570">(Jan 14 2021 at 22:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="245339">Nadrieril</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222796729">said</a>:</p>
<blockquote>
<p>Can we usually avoid having <code>FromTryResidual</code>/<code>Bubble</code> show up in public APIs btw? It would make explaining things easier if it could be documented as "internal" to reduce the learning burden</p>
</blockquote>
<p>I think so, especially with the flipped one -- it means that you could just call <code>Try::from_residual(...)</code> and not even notice that it's from a supertrait.</p>



<a name="222797588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797588">(Jan 14 2021 at 22:56)</a>:</h4>
<p>nice</p>



<a name="222797617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797617">(Jan 14 2021 at 22:57)</a>:</h4>
<p>(That almost works in the current version of the RFC, except that doing <code>Try::from_continue(...)</code> complains that you didn't specify the generic type for <code>Try</code>, despite the fact that it doesn't matter)</p>



<a name="222797697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797697">(Jan 14 2021 at 22:58)</a>:</h4>
<p>So you'd only have to think about the generic trait when implementing it, or when you're explicitly trying to mix residuals.</p>



<a name="222797761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222797761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222797761">(Jan 14 2021 at 22:59)</a>:</h4>
<p>you might not even need to if you're implementing it for a simple case</p>



<a name="222798035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222798035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222798035">(Jan 14 2021 at 23:01)</a>:</h4>
<p>You'd still have to mention the trait, though not the generic param.</p>



<a name="222798111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222798111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222798111">(Jan 14 2021 at 23:02)</a>:</h4>
<p>oh right indeed, misread you</p>



<a name="222798139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222798139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222798139">(Jan 14 2021 at 23:02)</a>:</h4>
<p>I'm still iffy about the location of <code>from_continue</code> from an explanatory perspective. I'd like <code>FromTryResidual</code>/<code>FromShortCircuit</code> to mean "types <code>T</code> such that <code>-&gt; T</code> functions can have <code>?</code> in them"; that reading makes me want to put <code>from_continue</code> there but that doesn't quite work</p>



<a name="222798498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222798498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222798498">(Jan 14 2021 at 23:06)</a>:</h4>
<p>hm actually it's fine if it's just functions. In my head I'm generalizing to "types <code>T</code> that can be the type of a <code>try</code> block", and that does require <code>from_continue</code> if I've followed things correctly</p>



<a name="222801020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222801020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222801020">(Jan 14 2021 at 23:35)</a>:</h4>
<p>Ah well you're doing sth different for <code>try</code> blocks anyways, so that would not be a correct description of the <code>FromShortCircuit</code> trait.</p>



<a name="222801146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222801146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222801146">(Jan 14 2021 at 23:36)</a>:</h4>
<p>I do like your point about "produce an <code>impl Try</code>" (<code>try{}</code> or <code>from_holder) vs "consume an </code>impl Try<code>" (</code>?`) being a nice split.</p>



<a name="222801193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222801193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222801193">(Jan 14 2021 at 23:37)</a>:</h4>
<p>It's just awkward to do with a consistent <code>Continue</code> type</p>



<a name="222802626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222802626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222802626">(Jan 14 2021 at 23:57)</a>:</h4>
<p>I guess we could have a <code>FromTryContinue</code> trait that works like <code>FromTryResidual</code>, and the <code>Continue</code> type would be pinned by the default type param. That's of course overkill, unless we manage to use it to replace <code>BreakHolder</code> somehow</p>



<a name="222802716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222802716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222802716">(Jan 14 2021 at 23:58)</a>:</h4>
<p>yeah no that's madness</p>



<a name="222803453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803453">(Jan 15 2021 at 00:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="245339">Nadrieril</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222802626">said</a>:</p>
<blockquote>
<p>unless we manage to use it to replace <code>BreakHolder</code> somehow</p>
</blockquote>
<p>I'm going to have to think on that one, in conjunction with your earlier point that the continue type is unused in FromTryResidual.</p>



<a name="222803534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803534">(Jan 15 2021 at 00:10)</a>:</h4>
<p>I can't see a way right now to do it, but this seems like one of those "will only come to you when doing something totally unrelated" kinds of insights...</p>



<a name="222803580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803580">(Jan 15 2021 at 00:11)</a>:</h4>
<p>Yeah, what I was exploring along these line is whether <code>from_continue</code> could actually be a member of <code>BreakHolder</code> or my previously suggested <code>GenericBubble</code> or sth like that</p>



<a name="222803669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803669">(Jan 15 2021 at 00:12)</a>:</h4>
<p>I don't think <code>BreakHolder</code> is the right place, because this topic has convinced me that <code>BreakHolder</code> should be irrelevant to everyone not trying to do the HKT scenarios</p>



<a name="222803672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803672">(Jan 15 2021 at 00:12)</a>:</h4>
<p>Related is the question of whether there might be a <code>Try</code> type that would lack a reasonable <code>from_continue</code></p>



<a name="222803703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803703">(Jan 15 2021 at 00:13)</a>:</h4>
<p>I'm confident that anything with a reasonable <code>branch</code> has a reasonable <code>from_continue</code>, because it's the thing that lets you put the <code>Continue</code> into that type in the first place.</p>



<a name="222803817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803817">(Jan 15 2021 at 00:14)</a>:</h4>
<p>The other way might not be true, though -- my <code>LogAndIgnoreErrors</code> example could make sense with <code>from_continue</code> and <code>from_holder</code> but not <code>branch</code>.</p>



<a name="222803833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803833">(Jan 15 2021 at 00:15)</a>:</h4>
<p>hm, <code>branch</code> might not be able to produce all possible values of the type <code>Continue</code></p>



<a name="222803853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803853">(Jan 15 2021 at 00:15)</a>:</h4>
<p>(But I also think that allowing <code>?</code> on it is low-impact, because it's not something that you'd be returning from a function anyway)</p>



<a name="222803872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803872">(Jan 15 2021 at 00:15)</a>:</h4>
<p>you could have <code>Continue = bool</code> and a <code>branch()</code> that never returns <code>Continue(false)</code> for some reason</p>



<a name="222803935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803935">(Jan 15 2021 at 00:16)</a>:</h4>
<p>something along the lines of packed errno maybe, but weirder</p>



<a name="222803937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803937">(Jan 15 2021 at 00:16)</a>:</h4>
<p>I'm not sure that's important to allow, though -- wouldn't it be good to encode that in the type system?</p>



<a name="222803976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222803976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222803976">(Jan 15 2021 at 00:17)</a>:</h4>
<p>So the packed pointer thing would probably return an <code>AlignedPtr&lt;T&gt;</code> or something, not just a <code>*mut T</code>.</p>



<a name="222804156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222804156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222804156">(Jan 15 2021 at 00:20)</a>:</h4>
<p>I don't want to underestimate the creativity of the rust community x)</p>



<a name="222804715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222804715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222804715">(Jan 15 2021 at 00:28)</a>:</h4>
<p>How about some kind of <code>ResultRef&lt;T,E&gt;</code> that has <code>Continue=&amp;T</code> and does transmute magic to make the conversion in a way that doesn't work for an arbitrarily allocated <code>&amp;T</code>. Maybe it stores either a <code>T</code>or some impossible value at the start of the allocation, and if relevant stores the <code>E</code> after the space reserved for the <code>T</code>.</p>



<a name="222804772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222804772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222804772">(Jan 15 2021 at 00:29)</a>:</h4>
<p>We could still decide that's a bit too crazy and not cater to that kind of thing, but I'd rather that be a concious choice than an lack of sufficiently mad creativity x)</p>



<a name="222805770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222805770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222805770">(Jan 15 2021 at 00:43)</a>:</h4>
<p>Cause then we could remove <code>from_continue</code> from <code>Try</code> and have this instead:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">ContinuableTry</span><span class="o">&lt;</span><span class="n">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="bp">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Try</span><span class="o">&gt;</span>::<span class="n">Continue</span><span class="o">&gt;</span>: <span class="nc">Try</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span>: <span class="nc">Try</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">C</span><span class="p">,</span><span class="w"> </span><span class="n">Residual</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Residual</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_continued</span><span class="p">(</span><span class="n">c</span>: <span class="nc">C</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Output</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Functions like <code>simple_try_fold</code> would just take a <code>ContinuableTry&lt;Continue=T&gt;</code> bound, and functions like <code>zip_demo</code> would change the type param. I believe this subsumes <code>BreakHolder</code> entirely, modulo some rethinking of <code>try</code> desugaring</p>



<a name="222805891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222805891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222805891">(Jan 15 2021 at 00:45)</a>:</h4>
<p>ah wait not quite &gt;&lt; <code>try_fold</code> would need <code>R::Output</code> which is not great. grmbl</p>



<a name="222806070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222806070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222806070">(Jan 15 2021 at 00:48)</a>:</h4>
<p>maybe</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">ContinuableTry</span><span class="o">&lt;</span><span class="n">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="bp">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Try</span><span class="o">&gt;</span>::<span class="n">Continue</span><span class="o">&gt;</span>: <span class="nc">Try</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">ChangeType</span>: <span class="nc">ContinuableTry</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">C</span><span class="p">,</span><span class="w"> </span><span class="n">Residual</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Residual</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_continued</span><span class="p">(</span><span class="n">c</span>: <span class="nc">Self</span>::<span class="n">Continue</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222806147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222806147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222806147">(Jan 15 2021 at 00:48)</a>:</h4>
<p>hrm, getting knots to my brain. Time to sleep <span aria-label="bed" class="emoji emoji-1f6cf" role="img" title="bed">:bed:</span></p>



<a name="222808019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222808019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222808019">(Jan 15 2021 at 01:16)</a>:</h4>
<p>The other downside of making <code>C</code> a generic type is that something like <code>let x: anyhow::Result&lt;i32&gt; = try { foo()?.parse()? };</code> stops working, because it can't get an expected type for the block body from the context any more.</p>



<a name="222808123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222808123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222808123">(Jan 15 2021 at 01:19)</a>:</h4>
<p>Said otherwise, because <code>let x: i64 = { 4 };</code> works, I'd like <code>let x: Option&lt;u8&gt; = try { 4 };</code> to also work.  (As opposed to defaulting the literal to <code>i32</code> and giving "<code>FromTryContinue&lt;i32&gt;</code> not implemented for <code>Option&lt;u8&gt;</code>" error.)</p>



<a name="222809035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222809035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222809035">(Jan 15 2021 at 01:34)</a>:</h4>
<p>does that work with the desugaring you propose in the RFC, based on <code>BreakHolder</code>?</p>



<a name="222809257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222809257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222809257">(Jan 15 2021 at 01:37)</a>:</h4>
<p>Oh yeah ok I see where the ambiguity comes from. I understand why the one with <code>BreakHolder</code> works</p>



<a name="222809314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222809314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222809314">(Jan 15 2021 at 01:38)</a>:</h4>
<p>Phew, so many constraints, I can see you've thought this through</p>



<a name="222809347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222809347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222809347">(Jan 15 2021 at 01:38)</a>:</h4>
<p>I should test the breakholder desugaring for that scenario, actually.  I think I only tested it with the other desugar.</p>



<a name="222809656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222809656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222809656">(Jan 15 2021 at 01:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="245339">Nadrieril</span> <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222809314">said</a>:</p>
<blockquote>
<p>Phew, so many constraints, I can see you've thought this through</p>
</blockquote>
<p>Thanks <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span>  It's been <a href="https://github.com/rust-lang/rfcs/pull/1859#issuecomment-279317876">almost 4 years</a> of thinking about it now <span aria-label="cold sweat" class="emoji emoji-1f630" role="img" title="cold sweat">:cold_sweat:</span></p>



<a name="222887954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222887954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222887954">(Jan 15 2021 at 16:55)</a>:</h4>
<p>for the record, here's my latest version with flipped dependency between traits and the "short-circuiting" vocab and many comments</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">/// Types `T` such that `-&gt; T` functions can have `?` in them. Usually implemented for</span>
<span class="sd">/// `ShortCircuiting` types, but there are also types like `()` that implement this yet cannot</span>
<span class="sd">/// themselves be the input of `?`.</span>
<span class="sd">///</span>
<span class="sd">/// The generic parameter is because a `ShortCircuiting` type may accept more types of</span>
<span class="sd">/// short-circuits than the one it emits. Typically `Result&lt;T, E&gt;` emits a short-circuit that</span>
<span class="sd">/// carries the `E`, but can accept short-circuits for any `E2: Into&lt;E&gt;`.</span>
<span class="k">trait</span><span class="w"> </span><span class="n">CatchShortCircuit</span><span class="o">&lt;</span><span class="n">SC</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="bp">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">ShortCircuiting</span><span class="o">&gt;</span>::<span class="n">ShortCircuit</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// If short-circuiting happened, construct the output value from the short-circuit data.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_short_circuited</span><span class="p">(</span><span class="n">sc</span>: <span class="nc">SC</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="sd">/// Types that can short-circuit control-flow with `?`.</span>
<span class="sd">///</span>
<span class="sd">/// A `x?` expression can either continue evaluation normally with a value of type</span>
<span class="sd">/// `Self::Continue`, or short-circuit into the nearest function boundary with a value of type</span>
<span class="sd">/// `Self::ShortCircuit`. The short-circuited value will then be converted to the appropriate</span>
<span class="sd">/// output type using `from_short_circuited`. If no short-circuiting happened, a `Continue` value</span>
<span class="sd">/// can also be converted into the output type using `from_continued`.</span>
<span class="sd">///</span>
<span class="sd">/// The trait is split in two because some types (like `()`) can accept short-circuits but not be</span>
<span class="sd">/// inputs of `?`.</span>
<span class="k">trait</span><span class="w"> </span><span class="n">ShortCircuiting</span>: <span class="nc">CatchShortCircuit</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The type of the carried data returned in the non-short-circuiting case.</span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Continue</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The type that carried the data that get's short-circuited.</span>
<span class="w">    </span><span class="k">type</span> <span class="nc">ShortCircuit</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Decide whether or not to short-circuit.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ControlFlow</span><span class="o">&lt;</span><span class="bp">Self</span>::<span class="n">ShortCircuit</span><span class="p">,</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Continue</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// If no short-circuiting happened, construct the output value from a `Continue` value.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_continued</span><span class="p">(</span><span class="n">c</span>: <span class="nc">Self</span>::<span class="n">Continue</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222943572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222943572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222943572">(Jan 16 2021 at 00:07)</a>:</h4>
<p>And my take on <code>BreakHolder</code>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">/// Sometimes a short-circuit type defines a "family" of related `ShortCircuiting` types with</span>
<span class="sd">/// varying `Continue` types but the same `ShortCircuit`. In this case, the `ShortCircuit` can</span>
<span class="sd">/// implement this trait, which makes it possible to make functions that are generic in such a</span>
<span class="sd">/// family.</span>
<span class="sd">///</span>
<span class="sd">/// If a short-circuit `SC` implements `ShortCircuitFamily&lt;T&gt;`, we can turn it into some type of</span>
<span class="sd">/// the family that implements `ShortCircuiting&lt;Continue = T, ShortCircuit = SC&gt;`.</span>
<span class="sd">/// For example, if `SC` is `&lt;Result&lt;T, E&gt;&gt;::ShortCircuit`, we can use that to turn the</span>
<span class="sd">/// short-circuiting case into a `Result&lt;U, E&gt;`.</span>
<span class="k">trait</span><span class="w"> </span><span class="n">ShortCircuitFamily</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span>: <span class="nc">ShortCircuiting</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">ShortCircuit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">zip_demo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">SC</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="c1">// The inputs are both of a short-circuiting type of a same family but for different `Continue` types,</span>
<span class="w">    </span><span class="c1">// for example `Option&lt;T&gt;` and `Option&lt;U&gt;`.</span>
<span class="w">    </span><span class="n">a</span>: <span class="nc">impl</span><span class="w"> </span><span class="n">ShortCircuiting</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">ShortCircuit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">SC</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">b</span>: <span class="nc">impl</span><span class="w"> </span><span class="n">ShortCircuiting</span><span class="o">&lt;</span><span class="n">Continue</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">ShortCircuit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">SC</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">)</span><span class="w"> </span>-&gt; <span class="o">&lt;</span><span class="n">SC</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">ShortCircuitFamily</span><span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="c1">// Using `ShortCircuitFamily`, we can construct the output type with the `Continue` type we want,</span>
<span class="w">    </span><span class="c1">// e.g. `Option&lt;(T, U)&gt;`. We need this bound to ensure the family supports this type.</span>
<span class="w">    </span><span class="n">SC</span>: <span class="nc">ShortCircuitFamily</span><span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="p">)</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">ShortCircuiting</span>::<span class="n">from_continued</span><span class="p">((</span><span class="n">a</span><span class="o">?</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="o">?</span><span class="p">))</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222943671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222943671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222943671">(Jan 16 2021 at 00:09)</a>:</h4>
<p>of course all subject to bikeshed, but now there's only one concept instead of three</p>



<a name="222949714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222949714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222949714">(Jan 16 2021 at 01:35)</a>:</h4>
<p>sortof related: Someone pointed out that my <code>continue_with</code> name was bad because that's the convention for something taking a closure, which is true.</p>
<p>But that made me think of <code>Vec::with_capacity</code>.  Translating that to the type level as <code>&lt;R as WithContinue&lt;(T, U)&gt;&gt;::Output</code> kinda works.</p>



<a name="222949779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222949779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222949779">(Jan 16 2021 at 01:36)</a>:</h4>
<p>(Looks weird as a bound, though)</p>



<a name="222953475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222953475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222953475">(Jan 16 2021 at 02:41)</a>:</h4>
<p>huh, not bad, it definitely makes the meaning of the parameter more legible</p>



<a name="222954964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222954964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222954964">(Jan 16 2021 at 03:09)</a>:</h4>
<p>Yeah, <code>with_continue</code> sounds more reasonable.</p>



<a name="222955173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222955173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222955173">(Jan 16 2021 at 03:13)</a>:</h4>
<p>hm, I wonder if continue is not the right word fwiw - you don't usually "continue with a value", unlike break. Maybe we can find something else, like "provide"? That would help here, I think</p>



<a name="222955883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222955883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222955883">(Jan 16 2021 at 03:27)</a>:</h4>
<p>I think continue makes sense personally</p>



<a name="222958113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/222958113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#222958113">(Jan 16 2021 at 04:10)</a>:</h4>
<p>Hmm, I'd actually only meant <code>WithContinue</code> at the type level.  Had been thinking of just going back to <code>from_continue</code> and <code>from_theotherbikeshed</code> like the other RFC used <code>from_ok</code> and <code>from_error</code>.</p>



<a name="223061315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/223061315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#223061315">(Jan 17 2021 at 20:26)</a>:</h4>
<p>continue confused me because I connected it to <code>continue</code> in loops</p>



<a name="223061321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/223061321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#223061321">(Jan 17 2021 at 20:26)</a>:</h4>
<p>particularly given the use of the word <code>break</code></p>



<a name="223062669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/223062669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#223062669">(Jan 17 2021 at 20:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> For methods, associated types, or both?</p>



<a name="223062837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Design%20meeting%202021-01-13%3A%20try_trait_v2/near/223062837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2.html#223062837">(Jan 17 2021 at 21:01)</a>:</h4>
<p>I think it confused me for all of them, personally, because I also connected it to loops</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>